<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>列表添加器</title>
    <link rel="stylesheet" href="../css/common.css">
    <style>
        div{
            padding: 20px;
        }
        ul{
            margin: 20px 0px;
        }
        span{
            display: inline-block;
            width: 30px;
            text-align: center;
        }
    </style>
</head>
<body>
    <div>
        <ul>
            <li><span>A.</span><input type="text"></li>
            <li><span>B.</span><input type="text"></li>
            <li><span>C.</span><input type="text"></li>
            <li><span>D.</span><input type="text"></li>
        </ul>
        <button>添加选项</button>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <script>
        let str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' //定义序号
        $('button').click(function(){
            let li = $('<li/>').append('<span>').append('<input/>')
            $('ul').append(li)
            sort()  //更新序号
        })

        //更新序号的方法
        function sort(){
            $('ul span').each(function(index,item){
                $(item).text(str[index]+'.')
            })
        }
    </script>
</body>
</html>